Repository navigation
Key the cloud engines' cache on the request's evidence and apply the Cloud Request Engine's cache rules - #300
Merged
Merged
Conversation
…oud Request Engine A cloud engine accepts no evidence, so there is no key to use in a results cache of its own, as the Cloud Aspect Engine specification says under "Configuration options", where it recommends the cache goes on the Cloud Request Engine instead. - The cache setting of DeviceDetectionCloudPipelineBuilder, DeviceDetectionPipelineBuilder, IpIntelligenceCloudPipelineBuilder, IpIntelligencePipelineBuilder and LocationPipelineBuilder now adds the cache to the Cloud Request Engine, as .NET's cloud pipeline builders do. That engine keys the cache on the evidence it sends and applies its own cache rules, so a response made for one visitor is neither stored nor served, and a request that carries a session id, a sequence, JA4 or HTTP/2 settings, or a sealed result to redeem always goes to the cloud service. The on-premise branches are unchanged, because those engines already refuse a cache. - CloudEngine.set_cache raises an exception that names the Cloud Request Engine, as the on-premise engines refuse a cache, and CloudEngine.process never uses a cache of the engine's own. DerivedCloud inherits both, so a redeemed Human Confidence result is never stored or served again. - The builders' documentation says where the cache goes, and that with the JavaScript builder on every request carries a session id, which the Cloud Request Engine sends to the cloud service every time. A caller that put a cache on a cloud engine directly now gets the exception, and adds the cache to the Cloud Request Engine instead. Tests, each failing on rc and passing here: - test_builder_cache.py in fiftyone_devicedetection_cloud, fiftyone_ipintelligence_cloud and location, and in the two examples packages for the combined builders: the cache is on the Cloud Request Engine, two different requests give their own results, and the same evidence again is answered from the cache with the JavaScript builder off. - test_cloudengine_cache.py: a cloud engine refuses a cache and reads each response whatever it holds. - test_human_confidence.py: DerivedCloud refuses a cache, and one held anyway never serves a redeemed result.
This was referenced Dec 1, 2026
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
The cache setting of the cloud pipeline builders now goes on the Cloud Request Engine, which keys the cache on the evidence it sends and applies its own cache rules. A cloud engine (
CloudEngineand every engine built on it,DerivedCloudincluded) refuses a cache and never uses one of its own.Why
A cloud engine accepts no evidence (
CloudEngine.get_evidence_key_filterreturns an empty list), so there is no key to use in a results cache of its own. The Cloud Aspect Engine specification says the same under "Configuration options", recommends the cache goes on the Cloud Request Engine, and lets an implementation restrict the option. .NET's cloud pipeline builders already put their results cache on the Cloud Request Engine (CloudPipelineBuilderBase.Build).The Cloud Request Engine's cache rules are in
cloudrequestengine.py(process,bypasses_cacheandis_cacheable). A response made for one visitor (a 51Did, a sealed HumanConfidence result, the browser tests' script) is neither stored nor served, and a request that carries a session id, a sequence, JA4 or HTTP/2 settings, or a sealed result to redeem always goes to the cloud service.What changed
pipeline/fiftyone_pipeline_cloudrequestengine/.../cloudengine.pyCloudEngine.set_cacheraises an exception that names the Cloud Request Engine, as the on-premise engines already refuse a cache.CloudEngine.processcallsprocess_internalwith no cache of the engine's own, whatever the engine holds.humanconfidence.py:DerivedCloudinherits both, so a redeemed Human Confidence result is never stored or served again. Its class documentation says so.The
cachesetting of these builders now callsset_cacheon the Cloud Request Engine rather than on the cloud engine, and their documentation says so:DeviceDetectionCloudPipelineBuilderandDeviceDetectionPipelineBuilder(cloud branch)IpIntelligenceCloudPipelineBuilderandIpIntelligencePipelineBuilder(cloud branch)LocationPipelineBuilderThe on-premise branches of the two combined builders are unchanged, because the on-premise engines' constructors already raise when given a cache.
Behaviour to know about
set_cacheon a cloud engine directly now gets the exception, which says to add the cache to the Cloud Request Engine instead.add_javascript_builder=False. The builders' documentation now says this.Tests
Each new test fails on
rc(df9a59c) and passes on this branch. I ran them both ways by setting the source change aside and running the same tests.test_builder_cache.pyinfiftyone_devicedetection_cloud,fiftyone_ipintelligence_cloudandlocation, and infiftyone_devicedetection_examplesandfiftyone_ipintelligence_examplesfor the combined builders, which have no test packages of their own. Against a stand-in for the cloud service, each checks that the cache is on the Cloud Request Engine and not on the cloud engine, that two different requests (User-Agents, IP addresses, positions) each get their own result, and that the same evidence again is answered from the cache with the JavaScript builder off.pipeline/fiftyone_pipeline_cloudrequestengine/tests/test_cloudengine_cache.py: a cloud engine refuses a cache, and one given a cache anyway reads each request's response and stores nothing.test_human_confidence.py:DerivedCloudrefuses a cache, and one given a cache anyway gives each request the values its own response holds and stores nothing.Local runs on Windows with Python 3.14, tests not marked live:
fiftyone_pipeline_cloudrequestenginefiftyone_pipeline_cloudrequestengine/examplesfiftyone_pipeline_enginesfiftyone_devicedetection_cloudfiftyone_ipintelligence_cloudlocationtest_builder_cache.pyin both examples packagesThe other examples tests that failed locally need data files that CI's asset fetch provides and this checkout did not have (
TAC-HashV41.hash, the evidence file,51Degrees-LiteV41.ipi), so CI is the check for those.Outstanding
+semverline.